package com.kuqi.controller;

import com.kuqi.domain.Account;
import com.kuqi.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author:kuqi
 * @description:
 */
@Controller("accountController") //spring可实例化bean标识，controller层
@RequestMapping(value = "/account",produces = "text/plain;charset=UTF-8")  //produces解决中文乱码问题
public class AccountController {

    @Autowired
    private AccountService accountService;

    @RequestMapping(value = "/save.do")
    @ResponseBody
    public String save(Account account){  //spring框架会自动匹配前端传递的数据，进行封装
        accountService.save(account);
        return "保存成功";
    }

}
